import { dateFormat } from '@/utils/date';

export default {
  shortcuts: [
    {
      text: '今天',
      value: () => {
        const today = new Date();
        today.setHours(0, 0, 0);
        let beginTime = dateFormat(today);
        today.setHours(23, 59, 59);
        let endTime = dateFormat(today);
        return [beginTime, endTime];
      }
    },
    {
      text: '昨天',
      value: () => {
        const today = new Date();
        today.setDate(today.getDate() - 1);
        today.setHours(0, 0, 0);
        let beginTime = dateFormat(today);
        today.setHours(23, 59, 59);
        let endTime = dateFormat(today);
        return [beginTime, endTime];
      }
    },
    {
      text: '一周内',
      value: () => {
        const lastWeek = new Date();
        lastWeek.setDate(lastWeek.getDate() - 6);
        lastWeek.setHours(0, 0, 0);
        let beginTime = dateFormat(lastWeek);
        let today = new Date();
        today.setHours(23, 59, 59);
        let endTime = dateFormat(today);
        return [beginTime, endTime];
      }
    },
    {
      text: '三个月内',
      value: () => {
        const threeMonthsAgo = new Date();
        threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
        threeMonthsAgo.setDate(threeMonthsAgo.getDate() + 1);
        threeMonthsAgo.setHours(0, 0, 0);
        let beginTime = dateFormat(threeMonthsAgo);
        let today = new Date();
        today.setHours(23, 59, 59);
        let endTime = dateFormat(today);
        return [beginTime, endTime];
      }
    }
  ],
};

